package com.sfjswl.fp.common.enums;

import java.util.HashMap;
import java.util.Map;

public enum NodeRunStateEnum {

  FALSE((byte) 0),

  TRUE((byte) 1),

  NONE((byte) 2),

  SHUT_DOWN((byte) 3);

  private static final Map<Byte, NodeRunStateEnum> MAP = new HashMap<>();

  static {
    for (NodeRunStateEnum enums : NodeRunStateEnum.values()) {
      MAP.put(enums.getState(), enums);
    }
  }

  private final byte state;

  NodeRunStateEnum(byte state) {
    this.state = state;
  }

  public static NodeRunStateEnum getEnum(byte state) {
    return MAP.get(state);
  }

  public byte getState() {
    return state;
  }
}
